<?php
	function add_meta($event,$key,$value) {
		$data = array(	"event"=>$event,
						"key"=>$key,
						"value"=>$value
						);
		return mysql_insert("event_meta",$data);
	}
	
	function update_meta($metaID,$value) {
		return mysql_update("event_meta",array("value"=>$value),array("id"=>$metaID));
	}
	
	function get_meta($event) {
		return mysql_array(mysql_select("event_meta",array("event"=>$event)));
	}
	
	function get_meta_keys() {
		return mysql_array(mysql_select("meta_keys",array()));
	}
	
	function make_link($string){
		$string = preg_replace("/([^\w\/])(www\.[a-z0-9\-]+\.[a-z0-9\-]+)/i", "$1http://$2",$string);
		$string = preg_replace("/([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/i","<a target=\"_blank\" href=\"$1\">$1</A>",$string);
		$string = preg_replace("/([\w-?&;#~=\.\/]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?))/i","<A HREF=\"mailto:$1\">$1</A>",$string);
		return $string;
}
	
?>